﻿// (c) Copyright Mikhail Dikov. All other rights reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI;
using System.Xml.Serialization;
using System.ComponentModel;
using WebPartExtenders;

namespace WebPartExtenderToolkit
{
    [ToolboxData("<{0}:FullScreenWebPart runat=server></{0}:FullScreenWebPart>")]
    [XmlRoot(Namespace = "FullScreenWebPart")]
    public class FullScreenWebPart : ExtenderWebPartBase
    {
        private FullScreenExtender extender;

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            extender = new FullScreenExtender();
            Controls.Add(extender);
            ChildControlsCreated = true;
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            extender.TargetControlID = this.TargetControlID;
            extender.Enabled = Enabled && !string.IsNullOrEmpty(TargetControlID); 
            extender.BehaviorID = this.BehaviorID;
            extender.ID = this.ID + "extender";            
            //Always hide the extender control chrome, because it'll show up as an empty webpart
            ChromeType = PartChromeType.None;
            Title = "Full Screen WebPart Extender";
         }

        #region FullScreenExtender Properies

     

	    #endregion
   
    }
}
